﻿namespace UnityEditor
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Runtime.CompilerServices;
    using System.Runtime.InteropServices;
    using UnityEditorInternal;
    using UnityEngine;

    internal class TreeView
    {
        [CompilerGenerated]
        private static Func<Node, int> <>f__am$cache13;
        [CompilerGenerated]
        private static Func<Node, int> <>f__am$cache14;
        private const float kSpaceForScrollBar = 16f;
        private bool m_AllowRenameOnMouseUp = true;
        public Action<int> m_ContextClickCallback;
        public ITreeViewDataSource m_Data;
        public Action<int[]> m_DragEndedCallback;
        public ITreeViewDragging m_Dragging;
        private List<int> m_DragSelection = new List<int>();
        private EditorWindow m_EditorWindow;
        private bool m_GrabKeyboardFocus;
        public ITreeViewGUI m_GUI;
        private bool m_HadFocusLastEvent;
        public Action<int> m_ItemDoubleClickedCallback;
        private int m_KeyboardControlID;
        public System.Action m_KeyboardInputCallback;
        public Action<int, Rect> m_OnGUIRowCallback;
        public Action<int[]> m_SelectionChangedCallback;
        public TreeViewState m_State;
        private Rect m_TotalRect;
        private bool m_UseScrollView = true;

        public TreeView(EditorWindow editorWindow, TreeViewState treeViewState)
        {
            this.m_EditorWindow = editorWindow;
            this.m_State = treeViewState;
        }

        private bool BeginNameEditing(float delay)
        {
            if (this.m_State.m_SelectedInstanceIDs.Count == 1)
            {
                Node node = this.m_Data.FindNodeByID(this.m_State.m_SelectedInstanceIDs[0]);
                if (node != null)
                {
                    if (this.m_Data.IsRenamingNodeAllowed(node))
                    {
                        return this.m_GUI.BeginRename(node, delay);
                    }
                }
                else
                {
                    Debug.LogError("Node not found for renaming with instanceID = " + this.m_State.m_SelectedInstanceIDs[0]);
                }
            }
            return false;
        }

        public void EndNameEditing(bool acceptChanges)
        {
            if (this.m_State.m_RenameOverlay.IsRenaming())
            {
                this.m_State.m_RenameOverlay.EndRename(acceptChanges);
                this.m_GUI.EndRename();
            }
        }

        public void EndPing()
        {
            this.m_GUI.EndPingNode();
        }

        private float EnsureRowIsVisible(int row, List<Node> rows)
        {
            float max = -1f;
            if (row >= 0)
            {
                max = this.m_GUI.GetTopPixelOfRow(row, rows);
                float min = (max - this.m_TotalRect.height) + this.m_GUI.GetHeightOfLastRow();
                this.m_State.m_ScrollPos.y = Mathf.Clamp(this.m_State.m_ScrollPos.y, min, max);
                return max;
            }
            return max;
        }

        public Node FindNode(int instanceID)
        {
            return this.m_Data.FindNodeByID(instanceID);
        }

        public void Frame(int instanceID, bool frame, bool ping)
        {
            float topPixelOfRow = -1f;
            Node node = null;
            if (frame)
            {
                this.RevealNode(instanceID);
                List<Node> visibleRows = this.m_Data.GetVisibleRows();
                int indexOfInstanceID = GetIndexOfInstanceID(visibleRows, instanceID);
                if (indexOfInstanceID >= 0)
                {
                    node = visibleRows[indexOfInstanceID];
                    topPixelOfRow = this.m_GUI.GetTopPixelOfRow(indexOfInstanceID, visibleRows);
                    this.EnsureRowIsVisible(indexOfInstanceID, visibleRows);
                }
            }
            if (ping)
            {
                if (topPixelOfRow == -1f)
                {
                    List<Node> nodes = this.m_Data.GetVisibleRows();
                    int row = GetIndexOfInstanceID(nodes, instanceID);
                    if (row >= 0)
                    {
                        node = nodes[row];
                        topPixelOfRow = this.m_GUI.GetTopPixelOfRow(row, nodes);
                    }
                }
                if ((topPixelOfRow >= 0f) && (node != null))
                {
                    float num4 = (this.GetContentSize().y <= this.m_TotalRect.height) ? 0f : -16f;
                    this.m_GUI.BeginPingNode(node, topPixelOfRow, this.m_TotalRect.width + num4);
                }
            }
        }

        public Vector2 GetContentSize()
        {
            return this.m_GUI.GetTotalSize(this.m_Data.GetVisibleRows());
        }

        private bool GetFirstAndLastSelected(List<Node> nodes, out int firstIndex, out int lastIndex)
        {
            firstIndex = -1;
            lastIndex = -1;
            for (int i = 0; i < nodes.Count; i++)
            {
                if (this.m_State.m_SelectedInstanceIDs.Contains(nodes[i].instanceID))
                {
                    if (firstIndex == -1)
                    {
                        firstIndex = i;
                    }
                    lastIndex = i;
                }
            }
            return ((firstIndex != -1) && (lastIndex != -1));
        }

        internal static int GetIndexOfInstanceID(List<Node> nodes, int instanceID)
        {
            for (int i = 0; i < nodes.Count; i++)
            {
                if (nodes[i].instanceID == instanceID)
                {
                    return i;
                }
            }
            return -1;
        }

        private List<int> GetNewSelection(Node clickedNode, bool keepMultiSelection, bool useShiftAsActionKey)
        {
            List<Node> visibleRows = this.m_Data.GetVisibleRows();
            List<int> allInstanceIDs = new List<int>(visibleRows.Count);
            for (int i = 0; i < visibleRows.Count; i++)
            {
                allInstanceIDs.Add(visibleRows[i].instanceID);
            }
            List<int> selectedInstanceIDs = this.m_State.m_SelectedInstanceIDs;
            int lastClickedInstanceID = this.m_State.m_LastClickedInstanceID;
            bool allowMultiSelection = this.m_Data.CanBeMultiSelected(clickedNode);
            return InternalEditorUtility.GetNewSelection(clickedNode.instanceID, allInstanceIDs, selectedInstanceIDs, lastClickedInstanceID, keepMultiSelection, useShiftAsActionKey, allowMultiSelection);
        }

        internal static int GetNodeControlID(Node node)
        {
            return (((node == null) ? 0 : node.instanceID) + 0x989680);
        }

        public int[] GetSelection()
        {
            return this.m_State.m_SelectedInstanceIDs.ToArray();
        }

        public Rect GetTotalRect()
        {
            return this.m_TotalRect;
        }

        public int[] GetVisibleRowIDs()
        {
            if (<>f__am$cache13 == null)
            {
                <>f__am$cache13 = node => node.instanceID;
            }
            return Enumerable.Select<Node, int>(this.m_Data.GetVisibleRows(), <>f__am$cache13).ToArray<int>();
        }

        public void GrabKeyboardFocus()
        {
            this.m_GrabKeyboardFocus = true;
        }

        private void HandleUnusedEvents()
        {
            EventType type = Event.current.type;
            switch (type)
            {
                case EventType.DragUpdated:
                    this.m_Dragging.DragElement(null, new Rect());
                    this.Repaint();
                    return;

                case EventType.DragPerform:
                    this.m_DragSelection.Clear();
                    this.m_Dragging.DragElement(null, new Rect());
                    this.Repaint();
                    return;

                case EventType.DragExited:
                    this.m_DragSelection.Clear();
                    this.m_Dragging.DragCleanup(true);
                    this.Repaint();
                    return;

                case EventType.ContextClick:
                    if (this.m_TotalRect.Contains(Event.current.mousePosition) && (this.m_ContextClickCallback != null))
                    {
                        this.m_ContextClickCallback(0);
                    }
                    return;
            }
            if ((type == EventType.MouseDown) && ((this.deselectOnUnhandledMouseDown && (Event.current.button == 0)) && (this.m_TotalRect.Contains(Event.current.mousePosition) && (this.m_State.m_SelectedInstanceIDs.Count > 0))))
            {
                this.SetSelection(new int[0], false);
                this.NotifyListenersThatSelectionChanged();
            }
        }

        private void HandleUnusedMouseEventsForNode(Rect rect, Node node)
        {
            int nodeControlID = GetNodeControlID(node);
            Event current = Event.current;
            EventType type = current.type;
            switch (type)
            {
                case EventType.MouseDown:
                    if (!rect.Contains(Event.current.mousePosition))
                    {
                        return;
                    }
                    if (Event.current.button != 0)
                    {
                        if (Event.current.button == 1)
                        {
                            bool keepMultiSelection = true;
                            this.SelectionClick(node, keepMultiSelection);
                        }
                        return;
                    }
                    GUIUtility.keyboardControl = this.m_KeyboardControlID;
                    this.Repaint();
                    if (Event.current.clickCount != 2)
                    {
                        this.m_DragSelection = this.GetNewSelection(node, true, false);
                        GUIUtility.hotControl = nodeControlID;
                        DragAndDropDelay stateObject = (DragAndDropDelay) GUIUtility.GetStateObject(typeof(DragAndDropDelay), nodeControlID);
                        stateObject.mouseDownPosition = Event.current.mousePosition;
                    }
                    else if (this.m_ItemDoubleClickedCallback != null)
                    {
                        this.m_ItemDoubleClickedCallback(node.instanceID);
                    }
                    break;

                case EventType.MouseUp:
                    if (GUIUtility.hotControl == nodeControlID)
                    {
                        if (rect.Contains(current.mousePosition))
                        {
                            float contentIndent = this.m_GUI.GetContentIndent(node);
                            Rect rect2 = new Rect(rect.x + contentIndent, rect.y, rect.width - contentIndent, rect.height);
                            List<int> selectedInstanceIDs = this.m_State.m_SelectedInstanceIDs;
                            if (((!this.m_AllowRenameOnMouseUp || (selectedInstanceIDs == null)) || ((selectedInstanceIDs.Count != 1) || (selectedInstanceIDs[0] != node.instanceID))) || (!rect2.Contains(current.mousePosition) || EditorGUIUtility.HasHolddownKeyModifiers(current)))
                            {
                                this.SelectionClick(node, false);
                            }
                            else
                            {
                                this.BeginNameEditing(0.5f);
                            }
                            GUIUtility.hotControl = 0;
                        }
                        this.m_DragSelection.Clear();
                        current.Use();
                    }
                    return;

                case EventType.MouseDrag:
                    if (GUIUtility.hotControl == nodeControlID)
                    {
                        DragAndDropDelay delay2 = (DragAndDropDelay) GUIUtility.GetStateObject(typeof(DragAndDropDelay), nodeControlID);
                        if (delay2.CanStartDrag())
                        {
                            this.m_Dragging.StartDrag(node, this.m_DragSelection);
                            GUIUtility.hotControl = 0;
                        }
                        current.Use();
                    }
                    return;

                default:
                    switch (type)
                    {
                        case EventType.DragUpdated:
                        case EventType.DragPerform:
                            if (this.m_Dragging.DragElement(node, rect))
                            {
                                GUIUtility.hotControl = 0;
                            }
                            return;

                        case EventType.ContextClick:
                            if (rect.Contains(current.mousePosition) && (this.m_ContextClickCallback != null))
                            {
                                this.m_ContextClickCallback(node.instanceID);
                            }
                            return;

                        default:
                            return;
                    }
                    break;
            }
            current.Use();
        }

        private bool HasFocus()
        {
            return (this.m_EditorWindow.m_Parent.hasFocus && (GUIUtility.keyboardControl == this.m_KeyboardControlID));
        }

        public bool HasSelection()
        {
            return (this.m_State.m_SelectedInstanceIDs.Count<int>() > 0);
        }

        public void Init(Rect rect, ITreeViewDataSource data, ITreeViewGUI gui, ITreeViewDragging dragging)
        {
            this.m_Data = data;
            this.m_GUI = gui;
            this.m_Dragging = dragging;
            this.m_TotalRect = rect;
        }

        private bool IsSameAsCurrentSelection(int[] selectedInstanceIDs)
        {
            if (selectedInstanceIDs.Length != this.m_State.m_SelectedInstanceIDs.Count)
            {
                return false;
            }
            for (int i = 0; i < selectedInstanceIDs.Length; i++)
            {
                if (selectedInstanceIDs[i] != this.m_State.m_SelectedInstanceIDs[i])
                {
                    return false;
                }
            }
            return true;
        }

        public bool IsSelected(int instanceID)
        {
            return this.m_State.m_SelectedInstanceIDs.Contains(instanceID);
        }

        public bool IsVisible(int instanceID)
        {
            return (GetIndexOfInstanceID(this.m_Data.GetVisibleRows(), instanceID) >= 0);
        }

        private void KeyboardGUI()
        {
            if ((this.m_KeyboardControlID == GUIUtility.keyboardControl) && GUI.enabled)
            {
                if (this.m_KeyboardInputCallback != null)
                {
                    this.m_KeyboardInputCallback();
                }
                if (Event.current.type == EventType.KeyDown)
                {
                    switch (Event.current.keyCode)
                    {
                        case KeyCode.KeypadEnter:
                        case KeyCode.Return:
                            if ((Application.platform == RuntimePlatform.OSXEditor) && this.BeginNameEditing(0f))
                            {
                                Event.current.Use();
                            }
                            return;

                        case KeyCode.UpArrow:
                            Event.current.Use();
                            this.OffsetSelection(-1);
                            return;

                        case KeyCode.DownArrow:
                            Event.current.Use();
                            this.OffsetSelection(1);
                            return;

                        case KeyCode.RightArrow:
                            foreach (int num2 in this.m_State.m_SelectedInstanceIDs)
                            {
                                Node node2 = this.m_Data.FindNodeByID(num2);
                                if (node2 != null)
                                {
                                    if (this.m_Data.IsExpandable(node2) && !this.m_Data.IsExpanded(node2))
                                    {
                                        if (Event.current.alt)
                                        {
                                            this.m_Data.SetExpandedWithChildren(node2, true);
                                        }
                                        else
                                        {
                                            this.m_Data.SetExpanded(node2, true);
                                        }
                                        this.UserExpandedNode(node2);
                                    }
                                    else if ((node2.children.Length > 0) && (this.m_State.m_SelectedInstanceIDs.Count == 1))
                                    {
                                        this.SelectionClick(node2.children[0], false);
                                    }
                                }
                            }
                            Event.current.Use();
                            return;

                        case KeyCode.LeftArrow:
                            foreach (int num in this.m_State.m_SelectedInstanceIDs)
                            {
                                Node node = this.m_Data.FindNodeByID(num);
                                if (node != null)
                                {
                                    if (this.m_Data.IsExpandable(node) && this.m_Data.IsExpanded(node))
                                    {
                                        if (Event.current.alt)
                                        {
                                            this.m_Data.SetExpandedWithChildren(node, false);
                                        }
                                        else
                                        {
                                            this.m_Data.SetExpanded(node, false);
                                        }
                                    }
                                    else if (((node.parent != null) && (this.m_State.m_SelectedInstanceIDs.Count == 1)) && this.m_Data.GetVisibleRows().Contains(node.parent))
                                    {
                                        this.SelectionClick(node.parent, false);
                                    }
                                }
                            }
                            Event.current.Use();
                            return;

                        case KeyCode.Home:
                            Event.current.Use();
                            this.OffsetSelection(-1000000);
                            return;

                        case KeyCode.End:
                            Event.current.Use();
                            this.OffsetSelection(0xf4240);
                            return;

                        case KeyCode.PageUp:
                        {
                            Event.current.Use();
                            Node fromNode = this.m_Data.FindNodeByID(this.m_State.m_LastClickedInstanceID);
                            if (fromNode != null)
                            {
                                int num3 = this.m_GUI.GetNumRowsOnPageUpDown(fromNode, true, this.m_TotalRect.height);
                                this.OffsetSelection(-num3);
                            }
                            return;
                        }
                        case KeyCode.PageDown:
                        {
                            Event.current.Use();
                            Node node4 = this.m_Data.FindNodeByID(this.m_State.m_LastClickedInstanceID);
                            if (node4 != null)
                            {
                                int offset = this.m_GUI.GetNumRowsOnPageUpDown(node4, true, this.m_TotalRect.height);
                                this.OffsetSelection(offset);
                            }
                            return;
                        }
                        case KeyCode.F2:
                            if ((Application.platform == RuntimePlatform.WindowsEditor) && this.BeginNameEditing(0f))
                            {
                                Event.current.Use();
                            }
                            return;
                    }
                    if ((Event.current.keyCode > KeyCode.A) && (Event.current.keyCode < KeyCode.Z))
                    {
                    }
                }
            }
        }

        public void NotifyListenersThatDragEnded(int[] draggedInstanceIDs)
        {
            if (this.m_DragEndedCallback != null)
            {
                this.m_DragEndedCallback(draggedInstanceIDs);
            }
        }

        public void NotifyListenersThatSelectionChanged()
        {
            if (this.m_SelectionChangedCallback != null)
            {
                this.m_SelectionChangedCallback(this.m_State.m_SelectedInstanceIDs.ToArray());
            }
        }

        private void OffsetSelection(int offset)
        {
            List<Node> visibleRows = this.m_Data.GetVisibleRows();
            if (visibleRows.Count > 1)
            {
                int indexOfInstanceID = GetIndexOfInstanceID(visibleRows, this.m_State.m_LastClickedInstanceID);
                int row = Mathf.Clamp(((indexOfInstanceID == -1) ? 0 : indexOfInstanceID) + offset, 0, visibleRows.Count - 1);
                this.SelectionByKey(visibleRows[row]);
                this.EnsureRowIsVisible(row, visibleRows);
                Event.current.Use();
            }
        }

        public void OnEvent()
        {
            this.m_State.m_RenameOverlay.OnEvent();
        }

        public void OnGUI(Rect rect, int keyboardControlID)
        {
            int num;
            int num2;
            this.m_TotalRect = rect;
            this.m_KeyboardControlID = keyboardControlID;
            Event current = Event.current;
            if (this.m_GrabKeyboardFocus || ((current.type == EventType.MouseDown) && this.m_TotalRect.Contains(current.mousePosition)))
            {
                this.m_GrabKeyboardFocus = false;
                GUIUtility.keyboardControl = this.m_KeyboardControlID;
                this.m_AllowRenameOnMouseUp = true;
                this.Repaint();
            }
            bool focused = this.HasFocus();
            if ((focused != this.m_HadFocusLastEvent) && (current.type != EventType.Layout))
            {
                this.m_HadFocusLastEvent = focused;
                if (focused && (current.type == EventType.MouseDown))
                {
                    this.m_AllowRenameOnMouseUp = false;
                }
            }
            List<Node> visibleRows = this.m_Data.GetVisibleRows();
            Vector2 totalSize = this.m_GUI.GetTotalSize(visibleRows);
            Rect viewRect = new Rect(0f, 0f, totalSize.x, totalSize.y);
            if (this.m_UseScrollView)
            {
                this.m_State.m_ScrollPos = GUI.BeginScrollView(this.m_TotalRect, this.m_State.m_ScrollPos, viewRect);
            }
            this.m_GUI.BeginRowGUI();
            float topPixel = !this.m_UseScrollView ? 0f : this.m_State.m_ScrollPos.y;
            this.m_GUI.GetFirstAndLastRowVisible(visibleRows, topPixel, this.m_TotalRect.height, out num, out num2);
            for (int i = num; i <= num2; i++)
            {
                Node node = visibleRows[i];
                bool selected = (this.m_DragSelection.Count <= 0) ? this.m_State.m_SelectedInstanceIDs.Contains(node.instanceID) : this.m_DragSelection.Contains(node.instanceID);
                Rect rect3 = this.m_GUI.OnRowGUI(node, i, GUIClip.visibleRect.width, selected, focused);
                if (this.m_OnGUIRowCallback != null)
                {
                    float contentIndent = this.m_GUI.GetContentIndent(node);
                    Rect rect4 = new Rect(rect3.x + contentIndent, rect3.y, rect3.width - contentIndent, rect3.height);
                    this.m_OnGUIRowCallback(node.instanceID, rect4);
                }
                this.HandleUnusedMouseEventsForNode(rect3, visibleRows[i]);
            }
            this.m_GUI.EndRowGUI();
            if (this.m_UseScrollView)
            {
                GUI.EndScrollView();
            }
            this.HandleUnusedEvents();
            this.KeyboardGUI();
        }

        public void ReloadData()
        {
            this.m_Data.ReloadData();
        }

        public void RemoveSelection()
        {
            if (this.m_State.m_SelectedInstanceIDs.Count > 0)
            {
                this.m_State.m_SelectedInstanceIDs.Clear();
                this.NotifyListenersThatSelectionChanged();
            }
        }

        public void Repaint()
        {
            this.m_EditorWindow.Repaint();
        }

        private void RevealNode(int instanceID)
        {
            if (!this.IsVisible(instanceID))
            {
                Node node = this.FindNode(instanceID);
                if (node != null)
                {
                    for (Node node2 = node.parent; node2 != null; node2 = node2.parent)
                    {
                        this.m_Data.SetExpanded(node2, true);
                    }
                }
            }
        }

        private void SelectionByKey(Node nodeSelected)
        {
            this.m_State.m_SelectedInstanceIDs = this.GetNewSelection(nodeSelected, false, true);
            this.m_State.m_LastClickedInstanceID = nodeSelected.instanceID;
            this.NotifyListenersThatSelectionChanged();
        }

        private void SelectionClick(Node nodeClicked, bool keepMultiSelection)
        {
            this.m_State.m_SelectedInstanceIDs = this.GetNewSelection(nodeClicked, keepMultiSelection, false);
            this.m_State.m_LastClickedInstanceID = (nodeClicked == null) ? 0 : nodeClicked.instanceID;
            this.NotifyListenersThatSelectionChanged();
        }

        public void SetSelection(int[] selectedInstanceIDs, bool revealSelectionAndFrameLastSelected)
        {
            <SetSelection>c__AnonStoreyD yd = new <SetSelection>c__AnonStoreyD {
                selectedInstanceIDs = selectedInstanceIDs
            };
            if (yd.selectedInstanceIDs.Length > 0)
            {
                if (revealSelectionAndFrameLastSelected)
                {
                    foreach (int num in yd.selectedInstanceIDs)
                    {
                        this.RevealNode(num);
                    }
                }
                this.m_State.m_SelectedInstanceIDs = new List<int>(yd.selectedInstanceIDs);
                if (this.m_State.m_SelectedInstanceIDs.IndexOf(this.m_State.m_LastClickedInstanceID) < 0)
                {
                    if (<>f__am$cache14 == null)
                    {
                        <>f__am$cache14 = node => node.instanceID;
                    }
                    List<int> list2 = Enumerable.Select<Node, int>(Enumerable.Where<Node>(this.m_Data.GetVisibleRows(), new Func<Node, bool>(yd.<>m__F)), <>f__am$cache14).ToList<int>();
                    if (list2.Count > 0)
                    {
                        this.m_State.m_LastClickedInstanceID = list2[list2.Count - 1];
                    }
                    else
                    {
                        this.m_State.m_LastClickedInstanceID = 0;
                    }
                }
                if (revealSelectionAndFrameLastSelected)
                {
                    this.Frame(this.m_State.m_LastClickedInstanceID, true, false);
                }
            }
            else
            {
                this.m_State.m_SelectedInstanceIDs.Clear();
                this.m_State.m_LastClickedInstanceID = 0;
            }
        }

        public void SetUseScrollView(bool useScrollView)
        {
            this.m_UseScrollView = useScrollView;
        }

        public void UserExpandedNode(Node node)
        {
        }

        public bool deselectOnUnhandledMouseDown { get; set; }

        [CompilerGenerated]
        private sealed class <SetSelection>c__AnonStoreyD
        {
            internal int[] selectedInstanceIDs;

            internal bool <>m__F(TreeView.Node node)
            {
                return this.selectedInstanceIDs.Contains<int>(node.instanceID);
            }
        }

        internal class Node
        {
            private TreeView.Node[] m_Children = new TreeView.Node[0];
            private int m_Depth;
            private string m_DisplayName;
            private Texture2D m_Icon;
            private int m_InstanceID;
            private TreeView.Node m_Parent;

            public Node(int instanceID, int depth, TreeView.Node parent, string displayName)
            {
                this.m_Depth = depth;
                this.m_Parent = parent;
                this.m_InstanceID = instanceID;
                this.m_DisplayName = displayName;
            }

            public static TreeView.Node FindNodeRecursive(TreeView.Node node, int instanceID)
            {
                if (node != null)
                {
                    if (node.instanceID == instanceID)
                    {
                        return node;
                    }
                    foreach (TreeView.Node node2 in node.children)
                    {
                        TreeView.Node node3 = FindNodeRecursive(node2, instanceID);
                        if (node3 != null)
                        {
                            return node3;
                        }
                    }
                }
                return null;
            }

            public override string ToString()
            {
                return string.Format("Node: '{0}' ({1}), has {2} children", this.displayName, this.instanceID, this.children.Length);
            }

            public virtual TreeView.Node[] children
            {
                get
                {
                    return this.m_Children;
                }
                set
                {
                    this.m_Children = value;
                }
            }

            public virtual int depth
            {
                get
                {
                    return this.m_Depth;
                }
            }

            public virtual string displayName
            {
                get
                {
                    return this.m_DisplayName;
                }
                set
                {
                    this.m_DisplayName = value;
                }
            }

            public virtual Texture2D icon
            {
                get
                {
                    return this.m_Icon;
                }
                set
                {
                    this.m_Icon = value;
                }
            }

            public virtual int instanceID
            {
                get
                {
                    return this.m_InstanceID;
                }
            }

            public virtual TreeView.Node parent
            {
                get
                {
                    return this.m_Parent;
                }
                set
                {
                    this.m_Parent = value;
                }
            }
        }
    }
}

